﻿using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace BF3StatsNetApi.BLL
{
    public class Weapon
    {
        public double time { get; set; }
        public long kills { get; set; }
        public long headshots { get; set; }
        public long hits { get; set; }
        public long shots { get; set; }
        public Star star { get; set; }
        public string name { get; set; }
        public string desc { get; set; }
        public string license { get; set; }
        public string category { get; set; }
        public string kit { get; set; }
        public string range { get; set; }
        public string fireModeAuto { get; set; }
        public string rateOfFire { get; set; }
        public string fireModeBurst { get; set; }
        public string fireModeSingle { get; set; }
        public string ammo { get; set; }
        public string img { get; set; }
        private List<Unlock> _unlocks;
        public object unlocks {
            get { return _unlocks; }
            set
            {
                _unlocks = new List<Unlock>();
                foreach (JToken nr in (JArray)value)
                {
                    Unlock _unlock = JsonConvert.DeserializeObject<Unlock>(nr.ToString());
                    _unlocks.Add(_unlock);
                }
            }
        }

    }
}
